
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'TrackBar: WinControl' { ... };

----------------------------------------------------------------------------------
-- func: TrackBar.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function TrackBar.__init__( self )
    WinControl.__init__( self );
end

----------------------------------------------------------------------------------
-- func: TrackBar:Create
-- desc: Creates a new TrackBar object.
----------------------------------------------------------------------------------
function TrackBar:Create( parent )
    if parent == nil or parent._object == nil then
        slimui:err( 'TrackBar:Create - parent must be set to create a control!' );
    end
    
    self._object = createTrackBar( parent._object );
    
    if self._object == nil then
        slimui:err( 'TrackBar:Create - failed to initialize a new object.' );
    end
    
    return self;
end

----------------------------------------------------------------------------------
-- func: TrackBar:GetMax
-- desc: Returns the max value this trackbar can obtain.
----------------------------------------------------------------------------------
function TrackBar:GetMax( )
    return trackbar_getMax( self._object );
end

----------------------------------------------------------------------------------
-- func: TrackBar:SetMax
-- desc: Sets the max value this trackbar can obtain.
----------------------------------------------------------------------------------
function TrackBar:SetMax( max )
    trackbar_setMax( self._object, max );
end

----------------------------------------------------------------------------------
-- func: TrackBar:GetMin
-- desc: Returns the min value this trackbar can obtain.
----------------------------------------------------------------------------------
function TrackBar:GetMin( )
    return trackbar_getMin( self._object );
end

----------------------------------------------------------------------------------
-- func: TrackBar:SetMin
-- desc: Sets the min value this trackbar can obtain.
----------------------------------------------------------------------------------
function TrackBar:SetMin( min )
    trackbar_setMin( self._object, min );
end

----------------------------------------------------------------------------------
-- func: TrackBar:GetValue
-- desc: Returns the current value of this trackbar.
----------------------------------------------------------------------------------
function TrackBar:GetValue( )
    return trackbar_getPosition( self._object );
end

----------------------------------------------------------------------------------
-- func: TrackBar:SetValue
-- desc: Sets the current value of this trackbar.
----------------------------------------------------------------------------------
function TrackBar:SetValue( value )
    trackbar_setPosition( self._object, value );
end

----------------------------------------------------------------------------------
-- func: TrackBar:OnChange
-- desc: Sets this trackbars OnChange event handler.
----------------------------------------------------------------------------------
function TrackBar:OnChange( func )
    trackbar_onChange( self._object, func );
end